<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title></title>
	<link rel="stylesheet" type="text/css" href="<?php echo PATH?>/web/css/ui.jqgrid.css">
	<link rel="stylesheet" type="text/css" href="<?php echo PATH?>/web/css/pepper-grinder/jquery-ui-1.10.3.custom.css">
	<link rel="stylesheet" type="text/css" href="<?php echo PATH?>/web/css/styles.css"/>
	
	<script type="text/javascript" src="<?php echo PATH?>/web/js/jquery-1.10.2.js"></script>
	<script type="text/javascript" src="<?php echo PATH?>/web/js/jquery-ui-1.10.3.custom.js"></script>
	<script type="text/javascript" src="<?php echo PATH?>/web/js/jqgrid/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" src="<?php echo PATH?>/web/js/jqgrid/grid.locale-es.js"></script>
</head>

	
<body>

	<script>
   	
	$(function() {  
        $(".datepicker").datepicker({  
        	dateFormat: 'dd/mm/yy',
        	minDate: -90,
        	maxDate: 0    
        });
        //$('#ui-datepicker-div').css("font-size", 14);
	});
	
		
	jQuery(document).ready(function () {
		jQuery("#dataTable").jqGrid({
	   	url:'../cliente/listarJson',
		datatype: "json",
	   	colNames:[
			'idCliente',
			'Nombre',
			'Tipo ID',
			'Identificador',
			'Cod cliente'
		],
		colModel :[
            {
            	name:'idCliente',
            	index:'idCliente',
            	hidden:true,
            	search:false
            },
            {
            	name:'nombreApell',
            	index:'nombreApell',
            	width:'80',
            	search:true,
            	searchoptions: { sopt: ['eq'] },
            	align:'center'
            },
            {
            	name:'tipoIdentif',
            	index:'tipoIdentif',
            	width:'40',
            	search:false,
            	align:'center'
            },
            {
            	name:'identificacion',
            	index:'identificacion',
            	width:'80',
            	search:true,
            	searchoptions: { sopt: ['eq'] },
            	align:'center'
            },
            {
            	name:'codCliente',
            	index:'codCliente',
            	width:'80',
            	search:true,
            	searchoptions: { sopt: ['eq'] },
            	align:'center'
            }
       	],
       	jsonReader: {
        	root: 'gridModel',
	      	id: 'idCliente',
	      	repeatitems: false,
	      	page:  function(obj) { return obj.page; },
	        total: function(obj) { return obj.total; },
	        records: function(obj) { return obj.records; }
     	},
     	height: "auto",
        width: 515,
	   	rowNum:10,
	   	rowList:[10,20,30],
	   	pager: '#dataTablePager',
	   	sortname: 'idCliente',
	    viewrecords: true,
	    onSelectRow: function(id){
	    	$("#codCliente").val($("#dataTable").getRowData(id).codCliente); 
        },
	    sortorder: "desc",
	    caption:"Clientes"
		});
		
		jQuery("#dataTable").jqGrid('navGrid','#dataTablePager',
			{edit:false,add:false,del:false,search:true,refresh:false},
			{}, //  default settings for edit
			{}, //  default settings for add
			{},  // delete instead that del:false we need this
			{}, // search options
			{} /* view parameters*/
        	);
        	
        // MENSAJES
		$(".message").click(function () {
	 		$(this).fadeOut();
	 	});
	 	
	 	$('#fechaInicio').bind('keypress',function(e){
			return false;
		})

	 	$('#fechafin').bind('keypress',function(e){
			return false;
		})
	
	});
	</script>
	
	<?php
	require 'web/pages/commons/header.php';
	?>
	
	<?php if(isset($response)) : ?>	
	<div class="message red" id="msjERRORTarea"  style="width: 900px; margin-left: 45px;margin-top: 10px;height: 40px;">
		<span><?php echo 'ERROR: '.$response?></span>
 	</div>
 	<?php endif; ?>
	<form style="width: 460px; margin-left: 25px; margin-top: 10px;" class="colDer" action="../reporte/generarTicket" method="post">
	
	<div id="dataFecha" style="width: 520px; margin-top: 10px;margin-left: 10px;">
		<div class="titulo" style="width: 500px;  margin-bottom: 10px;">
			<b style="font-size: 18px">Seleccione un rango de fecha para el reporte</b>
		</div>
		<div class="linea">
			<b>Fecha desde</b>
			<input type="text" class="datepicker" id="fechaInicio" name="fechaInicio" style="width: 160px;" required="true"/>	
		</div>
		<div class="linea">
			<b>Fecha hasta</b>
			<input type="text" class="datepicker" id="fechafin" name="fechafin" style="width: 160px;" required="true"/>	
		</div>
	</div>
	
	
	<div id="dataSumarizar" class="colDer" style="width: 520px; margin-top: 10px;margin-left: 10px;">
		<div class="titulo" style="width: 500px;  margin-bottom: 10px;">
			<b style="font-size: 18px">Sumarización de horas</b>
		</div>
		<div style="display: " id="tecnicos" class="linea">
			<?php 
			$select = "<select style='width: 250px;' id='sumarizar' size = 1 name='sumarizar'>\n";
			$select .= "<option value='0' selected >Sin Sumarizar</option>\n";
			$select .= "<option value='1'  >Diario</option>\n";
			$select .= "<option value='2'  >Semanal</option>\n";
			$select .= "<option value='3'  >Mensual</option>\n";
			$select .= "<option value='4'  >Anual</option>\n";
			echo $select . "</select>"
			?>
		</div>
	</div>
	
	<div id="dataTecnico" class="colDer" style="width: 520px; margin-top: 10px;margin-left: 10px;">
		<div class="titulo" style="width: 500px;  margin-bottom: 10px;">
			<b style="font-size: 18px">Seleccione clientes para el reporte</b>
		</div>
		<div style="display: " id="tecnicos" class="linea">
			<?php 
			$idEmpresa = $_SESSION['idEmpresa'];
			$clientes = cliente::listar($idEmpresa);
			$idCliente = null;
			$cant=count($clientes)+1;
			$select = "<select style='width: 250px;' id='clienteSeleccionado[]' size = 10 name='clienteSeleccionado[]' multiple>\n";
			$select .= "<option value='0' selected >Todos</option>\n";
			foreach($clientes as $c) {
				$idCliente = $c->idCliente;
   				$clie = $c->nombreApell;
	   			$select .= "<option value='$idCliente' >$clie</option>\n";
			}
			echo $select . "</select>"
			?>
		</div>
		<br>
		<div class="titulo" style="width: 500px;  margin-bottom: 10px;">
			<b style="font-size: 18px">Incluir grafico de barra</b>
			<input type=checkbox id='graf'  name='graf' onclick="if (window.document.all('grafico').value ==1) {window.document.all('grafico').value =0}else {window.document.all('grafico').value =1} ">
			<input type="hidden" id='grafico'  name='grafico' value='0' ">
		</div>
		<br>
	</div>
	
	<div style="margin-top: 10px">
		<button style="float: right; margin-right: 45px;" type="submit">Generar reporte</button>
		
		<button style="float: right; margin-right: 20px;" type="button" onclick="window.history.back()">Volver</button>	
	</div>
	</form>
	
</body>
</html>